package com.itlr.day03.homeWork12;

public class Test {

    public static void makeFly(CanFly canFly) {
        if (canFly != null) {
            System.out.println("准备起飞...");
            canFly.fly();
            System.out.println("飞行结束！");
            System.out.println();
        } else {
            System.out.println("无法让null对象飞行！");
        }
    }
    
    public static void main(String[] args) {
        // 创建飞机对象
        Plane plane1 = new Plane("民航客机", "空客A320");
        Plane plane2 = new Plane("货运飞机", "运-20");

        // 创建鸟对象
        Bird bird1 = new Bird("凤凰", "神鸟", "五彩");
        Bird bird2 = new Bird("小燕子", "燕子", "黑白");
        Bird bird3 = new Bird("小鸽子", "鸽子", "黑白");

        makeFly(plane1);
        makeFly(plane2);

        makeFly(bird1);
        makeFly(bird2);
        makeFly(bird3);

        System.out.println("========= 测试完成 =========");
    }
}